import {reqbannerlist} from "../../http/api"
const state = {
    // 1.初始值
    list:[]
}

const getters = {
    //2.导出给组件
    list(state){
        return state.list
    }
}

const mutations = {
    //3.修改
    changeList(state,list){
        state.list=list;
    }
}

const actions = {
    // 4.逻辑
    reqList(context){
        //发请求
        console.log(1111);
        reqbannerlist({}).then(res=>{
            if(res.data.code==200){
                console.log(res);
                //修改list 
                context.commit("changeList",res.data.list?res.data.list:[])
            }
        })
    }
}

export default {
    state,
    getters,
    mutations,
    actions,
    namespaced: true
}